package com.hotelManagerSystem.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 * @description 所有的视图或者页面跳转都写在ViewController
 * */
@Controller
@RequestMapping("/view")
public class ViewController {
    /**
     * @author treasy
     * @description 前往admin-login.html
     */
    @RequestMapping("/admin-login")
    public String adminLogin(){
        return "/admin/admin-login";
    }

    /**
     * @author treasy
     * @description 前往customer-login.html,并设置为项目启动默认访问页面
     */
    @RequestMapping("/customer-login")
    public String customerLogin(){
        return "/customer/customer-login";
    }
    /**
     * @author treasy
     * @description 前往customer-register.html
     */
    @RequestMapping("/customer-register")
    public String customerRegister(){
        return "/customer/customer-register";
    }
    /**
     * @author treasy
     * @description 访问测试页面
     */
    @RequestMapping("/customer-index")
    public String customerIndex(Model model){
        Subject currentUser = SecurityUtils.getSubject();
        //获取当前用户username
        String username = (String) currentUser.getSession().getAttribute("username");
        model.addAttribute("username", username);
        return "/customer/customer-index";
    }
    /**
     * @author treasy
     * @description 前往admin-index.html
     */
    @RequestMapping("/admin-index")
    public String adminIndex(){
        return "/admin/admin-index";
    }
    /**
     * @author treasy
     * @description 前往clean-info.html
     */
    @RequestMapping("/clean-info")
    public String cleanInfo(){
        return "/admin/cleanPage/clean-info";
    }
    /**
     * @author treasy
     * @description 前往dinner-info.html
     */
    @RequestMapping("/dinner-info")
    public String dinnerInfo(){
        return "/admin/dinnerPage/dinner-info";
    }
    /**
     * @author treasy
     * @description 前往clean-edit.html
     */
    @RequestMapping("/clean-edit")
    public String cleanEdit(){
        return "/admin/cleanPage/clean-edit";
    }

    /**
     * @author treasy
     * @description 前往welcome1.html
     */
    @RequestMapping("/welcome1")
    public String welcome1(){
        return "/admin/welcome1";
    }

//    /**
//     * @author longyajr
//     * @description 跳转至房间订单页面
//     */
//    @RequestMapping("/room-order-list")
//    public String roomOrderList(){
//        return "/admin/orderPage/order-list";
//    }
}
